/**
 * 
 */
package com.thor.palmmall.rest.todo.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.todo.ATaskParam;
import com.thor.palmmall.spi.todo.STaskParam;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class STaskParamConverter implements Converter<ATaskParam, STaskParam> {

  public static STaskParamConverter getInstance() {
    if (instance == null)
      instance = new STaskParamConverter();
    return instance;
  }

  private static STaskParamConverter instance;

  private STaskParamConverter() {
  }

  @Override
  public STaskParam convert(ATaskParam source) {
    if (source == null) {
      return null;
    }
    STaskParam target = new STaskParam();
    target.setBillUuid(source.getBillUuid());
    target.setTaskUuid(source.getTaskUuid());
    target.setOperatorUser(UCN.newInstance(source.getOperatorUser()));
    target.setUser(UCN.newInstance(source.getUser()));
    return target;
  }

}
